package cn.itsource.desktop.api;

import cn.itsource.constants.Constants;
import cn.itsource.desktop.fallback.LoginApiFallback;
import cn.itsource.desktop.pojo.param.LoginFound;

import cn.itsource.desktop.pojo.param.LoginUpdate;
import cn.itsource.result.JSONResult;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;

import javax.validation.Valid;

//认证服务-Login相关API
@FeignClient(value = Constants.Remote.SERVICE_UAA,fallbackFactory = LoginApiFallback.class)
@Tag(name = "登录表",description = "登录表")
public interface LoginApi {
    //保存一个Login
    @PostMapping("/remote/login/create")
    @Operation( summary= "远程保存Login",description = "远程保存Login")
    @Parameter(name = "login",description = "保存的对象",required = true)
    JSONResult create(@RequestBody @Valid LoginFound login);

    @PutMapping("/remote/login/update")
    @Operation( summary= "修改Login",description = "修改Login")
    @Parameter(name = "login",description = "修改的对象",required = true)
    JSONResult update(@RequestBody @Valid LoginUpdate login);

}
